package snmptest.gateway;

import com.isnmp.common.snmp.SNMPAPI;
import com.isnmp.common.snmp.SNMPFactory;
import com.isnmp.common.snmp.SNMPTarget;
import com.isnmp.common.snmp.mib.MibSystem;

public class PerformanceTest {
    public static void main(String[] args) {
        try {
            SNMPTarget target = new SNMPTarget();
            target.nodeIP = "127.0.0.1";
            SNMPFactory.init(1, null, 8088);
            SNMPAPI snmpapi = SNMPFactory.getSNMPAPI();
            MibSystem mibsystem = new MibSystem();
            System.out.println("开始获取数据");
            long timeStart = System.currentTimeMillis();
            for (int i = 0; i < 10000; i++) {
                Object localObject = snmpapi.getMibObject(mibsystem, target);
            }
            long timeEnd = System.currentTimeMillis();
            System.out.println("获取1万个MIBSystem的时间:" + (timeEnd - timeStart) / 1000L + "秒");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}